import request from '/@/utils/request';

/**
 * 货品管理相关接口
 */

// 分页查询
export function getGoodsPage(params) {
	return request({
		url: '/platform/goods/page',
		method: 'get',
		params,
	});
}

// 通过条件查询
export function getGoodsDetails(params) {
	return request({
		url: '/platform/goods/details',
		method: 'get',
		params,
	});
}

// 新增货品信息
export function addGoods(data) {
	return request({
		url: '/platform/goods/addGoods',
		method: 'post',
		data,
	});
}

// 修改货品信息
export function updateGoods(data) {
	return request({
		url: '/platform/goods/updateById',
		method: 'put',
		data,
	});
}

// 通过id启用/禁用货品信息
export function toggleGoodsStatus(data) {
	return request({
		url: `/platform/goods/forbidById`,
		method: 'put',
		data,
	});
}

// 通过id删除货品
export function deleteGoods(data) {
	return request({
		url: `/platform/goods`,
		method: 'delete',
		data,
	});
}
